<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>薪资套账</title>
<script type="text/javascript" src="static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="static/easyui/locale/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" href="static/easyui/themes/icon.css">
<link rel="stylesheet" href="static/easyui/themes/metro-blue/easyui.css">
</head>
<body>
<link rel="stylesheet" href="static/easyui/themes/salary-emp.css">
<style type="text/css">
	*{
		margin:0px;
		padding:0px;
	}
	.background{
		width: 1120px;
	    height: 570px;
	    margin: 0px auto;
	    margin-top: 10px;
	    background-color: #FFF;
	}
	.notice-head{
		width: 1100px;
	    height: 45px;
	    border-bottom: 1px solid #F3F3F9;
	    color: #19AA9A;
	    font-size: 18px;
	    text-align: center;
	    line-height: 45px;
	    font-weight: 700;
	}
	.es-head{
		width: 1125px;
		height:60px;
		margin:0px auto;
	}
	.head-left{
		width: 360px;
	    height: 27px;
	    float: left;
	    margin-top: 20px;
	}
	.head-left .textbox{
		width:150px;
	}
	#mingchen{
		font-size: 14px;
		margin-left:45px;
	}
	#salary-name{
		width: 150px;
	    height: 20px;
	    border-radius: 3px;
	    border: 1px solid #ccc;
	}
	.table{
		width: 1020px;
		margin:0px auto;
		margin-top:20px;
		border: 1px solid #E5E5E5;		
	}
	.datagrid-header .datagrid-cell span{
		color: #19AA9A;
	    font-size: 14px;
	    font-weight: 700;
	}
	.datagrid-header .datagrid-cell,.datagrid-cell, .datagrid-cell-group, .datagrid-header-rownumber, .datagrid-cell-rownumber {
		text-align: center;
	}
	.table .datagrid .panel-body{
	 	width: 1017px;
	}
	.datagrid-header{
		height:39px;
	}
	.datagrid-header-row, .datagrid-row {
   	 	height: 40px;
	}
	.bianji,.xiangqing{
		width: 45px;
    	height: 20px;
		font-size:12px;
		border-radius:4px;
	}
	.bianji{
		color:#fff;
		background-color:#18A689;
		border:1px solid #18A689;
	}
	.xiangqing{
		color:#666666;
		border:1px solid #E4E4E4;
		background-color:#fff;
	}
	.chaxun-button{
		width: 50px;
	    height: 22px;
	    border: 1px solid #18A689;
	    background-color: #18A689;
	    color: #fff;
	    border-radius: 4px;
	    margin-left: 21px;
	    line-height: 22px;
	}
	.chakansc{
		background:#17AA8D;
		border-radius:3px;
		color:white;
		margin:0 4px;
		width:60px;
		height:25px;
		border:none;
		outline: none;
		cursor:pointer;
	}
	.jysc{
		background:#d9534f;
		border-radius:3px;
		color:white;
		margin:0 4px;
		width:60px;
		height:25px;
		border:none;
		outline: none;
		cursor:pointer;
	}
	.jysc:hover{
		background-color:#C9302C;
	}
	.chakansc:hover{
		background-color:#13826B;
	}
</style>
<script type="text/javascript">
		function add(text){
			$("#content-admin").panel({
				href:text
			});
		}
		function mingxi(s){
			add("salary-mingxi?account_id="+s);
		}
		function bianji(s){	
			add("salary-emp-add?account_id="+s);			
		}		
		function jinyong(account_id){
			$.ajax({
				url:"jinyong",
				type:"post",
				data:{account_id:account_id},
				success: function (result) {
					alert("禁用成功")
					$("#content-admin").panel('open').panel('refresh','salary-emp');
                }
			})
		} 
		$(function(){
			$("#table_account").datagrid({
				url:'showaccount',
				singleSelect:true,			
				columns:[[{field:'account_id',hidden:true},
						{field:'account_name',title:'套账名称',width:160},
	               		{field:'sa_dass',title:'薪资等级',width:160},
	               		{field:'sa_date',title:'创建日期',width:220,
	               			formatter:function formattime(value,row,index){
	    			    		var date = new Date(value);
	    				        var year = date.getFullYear().toString();
	    				        var month = (date.getMonth() + 1);
	    				        var day = date.getDate().toString();
	    				        var hour = date.getHours().toString();
	    				        var minutes = date.getMinutes().toString();
	    				        var seconds = date.getSeconds().toString();
	    				        if (month < 10) {
	    				            month = "0" + month;
	    				        }
	    				        if (day < 10) {
	    				            day = "0" + day;
	    				        }
	    				        if (hour < 10) {
	    				            hour = "0" + hour;
	    				        }
	    				        if (minutes < 10) {
	    				            minutes = "0" + minutes;
	    				        }
	    				        if (seconds < 10) {
	    				            seconds = "0" + seconds;
	    				        }
	    				        return year + "-" + month + "-" + day + " " + hour + ":" + minutes + ":" + seconds;
	    				}},
	          			{field:'Staffs_name',title:'创建人',width:180},
	          			{field:'sa_remarks',title:'备注',width:160,
	          				formatter: function(value,row,index){
								if (row["sa_remarks"] == null||row["sa_remarks"] == ""){
									return "暂无";
								}else{
									return value;
								}
							}},
	               		{field:'caozuo',title:'操作',width:220,
	          				formatter:function(value,row,index){	          					
	          					return "<input type='button' class='chakansc' onclick='bianji("+row['account_id']+")' value='查看'/>";
							}						
					  }
	          ]],
	          pagination:true,
			    pageNumber:1,
			    pageSize:5,
			    pageList:[5,10,15]
			});
		});
		$("#ss-2").click(function(){
			var a=$("#salary-name").combogrid('grid');
			var b=a.datagrid('getSelected');
			if(b=="" || b==null){
				alert("请选择套账");
				return false;
			}else{				
				$("#table_account").datagrid({
					url:'find-name',
					singleSelect:true,			
					columns:[[{field:'account_id',hidden:true},
						{field:'account_name',title:'套账名称',width:160},
	               		{field:'sa_dass',title:'薪资等级',width:160},
	               		{field:'sa_date',title:'创建日期',width:220,
	               			formatter:function formattime(value,row,index){
	    			    		var date = new Date(value);
	    				        var year = date.getFullYear().toString();
	    				        var month = (date.getMonth() + 1);
	    				        var day = date.getDate().toString();
	    				        var hour = date.getHours().toString();
	    				        var minutes = date.getMinutes().toString();
	    				        var seconds = date.getSeconds().toString();
	    				        if (month < 10) {
	    				            month = "0" + month;
	    				        }
	    				        if (day < 10) {
	    				            day = "0" + day;
	    				        }
	    				        if (hour < 10) {
	    				            hour = "0" + hour;
	    				        }
	    				        if (minutes < 10) {
	    				            minutes = "0" + minutes;
	    				        }
	    				        if (seconds < 10) {
	    				            seconds = "0" + seconds;
	    				        }
	    				        return year + "-" + month + "-" + day + " " + hour + ":" + minutes + ":" + seconds;
	    				}},
	          			{field:'Staffs_name',title:'创建人',width:180},
	          			{field:'sa_remarks',title:'备注',width:160,
	          				formatter: function(value,row,index){
								if (row["sa_remarks"] == null||row["sa_remarks"] == ""){
									return "暂无";
								}else{
									return value;
								}
							}},
	               		{field:'caozuo',title:'操作',width:220,
	          				formatter:function(value,row,index){	          					
	          					return "<input type='button' class='chakansc' onclick='bianji("+row['account_id']+")' value='查看'/>";
							}								
					  }
		          ]],
		          queryParams: {
		      		account_id:b.account_id
		      		},
		          	pagination:true,
				    pageNumber:1,
				    pageSize:5,
				    pageList:[5,10,15]
				});
			}
		});
		$("#ss-2").dblclick(function(){
			$("#table_account").datagrid({
				url:'showaccount',
				singleSelect:true,			
				columns:[[{field:'account_id',hidden:true},
						{field:'account_name',title:'套账名称',width:160},
	               		{field:'sa_dass',title:'薪资等级',width:160},
	               		{field:'sa_date',title:'创建日期',width:220,
	               			formatter:function formattime(value,row,index){
	    			    		var date = new Date(value);
	    				        var year = date.getFullYear().toString();
	    				        var month = (date.getMonth() + 1);
	    				        var day = date.getDate().toString();
	    				        var hour = date.getHours().toString();
	    				        var minutes = date.getMinutes().toString();
	    				        var seconds = date.getSeconds().toString();
	    				        if (month < 10) {
	    				            month = "0" + month;
	    				        }
	    				        if (day < 10) {
	    				            day = "0" + day;
	    				        }
	    				        if (hour < 10) {
	    				            hour = "0" + hour;
	    				        }
	    				        if (minutes < 10) {
	    				            minutes = "0" + minutes;
	    				        }
	    				        if (seconds < 10) {
	    				            seconds = "0" + seconds;
	    				        }
	    				        return year + "-" + month + "-" + day + " " + hour + ":" + minutes + ":" + seconds;
	    				}},
	          			{field:'Staffs_name',title:'创建人',width:180},
	          			{field:'sa_remarks',title:'备注',width:160,
	          				formatter: function(value,row,index){
								if (row["sa_remarks"] == null||row["sa_remarks"] == ""){
									return "暂无";
								}else{
									return value;
								}
							}},
	               		{field:'caozuo',title:'操作',width:220,
	          				formatter:function(value,row,index){	          					
	          					return "<input type='button' class='chakansc' onclick='bianji("+row['account_id']+")' value='查看'/>";
							}						
					  }
	          ]],
	          pagination:true,
			    pageNumber:1,
			    pageSize:5,
			    pageList:[5,10,15]
			});
		});
		function tianjia(){
			add("salary-emp-tianjia");
		}
</script>
	<div class="background">
		<div class="notice-head">薪资套账</div>
		<div class="es-head">
			<div class="head-left">
				<span id="mingchen">名称：</span>
				<select id="salary-name" editable="false" class="easyui-combogrid" name="salaryaccount" style="width:150px;"
					  	data-options="
					    panelWidth:400,
					    idField:'account_id',
					    textField:'account_name',
					    url:'sajingyong',
					    columns:[[
						{field:'account_name',title:'套账名称',width:85},
	               		{field:'sa_dass',title:'薪资等级',width:60},
	          			{field:'Staffs_name',title:'创建人',width:60},
	          			{field:'sa_remarks',title:'备注',width:80}
					    ]]">
				</select>
				<a id="ss-2"  class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true"></a>
				<a id="tianjia-button"  onclick="tianjia()" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true"></a>
			</div>
		</div>
		<div class="table">
			<input type='hidden' id='account_id'>
			<table id="table_account" class="easyui-datagrid" style="width:1020px;height:400px"></table>
		</div>
	</div>
</body>
</html>